import axios from "@/axios";

/**
 * 获取验证码和随机码
 * @param data
 * @returns {*}
 */
export function getCaptchaImg(data) {
    return axios({
        url: '/captcha',
        method: 'get',
        params: data
    })
}

/**
 * 登录
 * @param data
 * @returns {*}
 */
export function toLogin(data) {
    return axios({
        url: '/login',
        method: 'post',
        params: data,
        headers: {
            code: data.code,
            key: data.key
        }
    })
}


/**
 * 获取用户信息
 * @param data
 * @returns {*}
 */
export function getUserInfo(data) {
    return axios({
        url: '/userInfo',
        method: 'get',
        params: data
    })
}


/**
 * 登出
 * @param data
 * @returns {*}
 */
export function logout(data) {
    return axios({
        url: '/logout',
        method: 'post',
        data: data
    })
}



/**
 * 获取用户菜单以及权限接口
 * @param data
 * @returns {*}
 */
export function getUserMenuAndAuth(data) {
    return axios({
        url: '/sys/menuAndAuth',
        method: 'get',
        params: data,
        headers: {
            'Authorization': localStorage.getItem('token')
        }
    })
}

